package com.whmnx.my.ui.viewmodel;

import androidx.annotation.NonNull;
import androidx.databinding.ObservableField;

import com.whmnx.base.bean.JiaoYiBean;
import com.whmnx.my.ui.fragment.MyOrderDetailsFragment;

import me.goldze.mvvmhabit.base.BaseViewModel;
import me.goldze.mvvmhabit.base.ItemViewModel;
import me.goldze.mvvmhabit.binding.command.BindingAction;
import me.goldze.mvvmhabit.binding.command.BindingCommand;

/**
 * author : huang
 * date   : 2020/9/15 0015 16:48
 * version: 1.0
 * @author Administrator
 */
public class JiaoYiItemViewModel extends ItemViewModel {

    public ObservableField<JiaoYiBean.RecordListBean> entity = new ObservableField<>();

    //交易价格
    public ObservableField<String> Deal_Num = new ObservableField<>("");
    public ObservableField<String> Deal_Price = new ObservableField<>("");
    public ObservableField<String> Deal_StatusDesc = new ObservableField<>("");
    public ObservableField<String> CreateDate = new ObservableField<>("");

    public JiaoYiItemViewModel(@NonNull BaseViewModel viewModel, JiaoYiBean.RecordListBean recordListBean) {
        super(viewModel);
        this.entity.set(recordListBean);
        Deal_Num.set("收购播豆（个）：" + recordListBean.getDeal_Num());
        Deal_Price.set(recordListBean.getDeal_Price() + "");
        Deal_StatusDesc.set(recordListBean.getDeal_StatusDesc());
        CreateDate.set(recordListBean.getCreateDate());
    }

    //订单详情
    public BindingCommand  OnClickCommand = new BindingCommand(new BindingAction() {
        @Override
        public void call() {
            viewModel.startContainerActivity(MyOrderDetailsFragment.class.getCanonicalName());
        }
    });
}
